<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script> 
      //4.Class (ES6)
        class Student{
            //构造函数
            constructor(name,age){
                this.name=name
                this.age=age
                console.log("构造函数被调用了")
            }
            //定义一个方法,该方法是放在此对象的原型
            sayHello(){
                console.log("覅覅,hello")
            }
            }
        let c=new Student("松",20)
        let a = new Student("菘",18)
        a.sayHello()
        console.log(a.name)
        console.log(a)
            //原型（prototype）与原型链（高级）
            console.log(a.__proto__==c.__proto__)
            //a.__proto__.height = 180
            let s2 = new Student("wangwu",23)
            console.log(s2)
            //对象常用的方法(Object.XXX())
            let product ={
                name:'霸王茶姬',
                price:18,
                flavor:"great"
            }
            let keys = Object.keys(product)
            console.log(keys)
            console.log(Object.values(product))
            console.log(Object.entries(product))
            let entries = Object.entries(product)
            for(items of entries){
                console.log(items)
                for(item of items){
                    console.log(item)
                }
            }
            //函数
            function sum(){
                console.log("")
            }</script>
</body>
</html>